import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ChefVO, ChefForm, ChefQuery } from '@/api/kitchen/chef/types';

/**
 * 查询厨师列表
 * @param query
 * @returns {*}
 */

export const listChef = (query?: ChefQuery): AxiosPromise<ChefVO[]> => {
  return request({
    url: '/kitchen/chef/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询厨师详细
 * @param id
 */
export const getChef = (id: string | number): AxiosPromise<ChefVO> => {
  return request({
    url: '/kitchen/chef/' + id,
    method: 'get'
  });
};

/**
 * 新增厨师
 * @param data
 */
export const addChef = (data: ChefForm) => {
  return request({
    url: '/kitchen/chef',
    method: 'post',
    data: data
  });
};

/**
 * 修改厨师
 * @param data
 */
export const updateChef = (data: ChefForm) => {
  return request({
    url: '/kitchen/chef',
    method: 'put',
    data: data
  });
};

/**
 * 删除厨师
 * @param id
 */
export const delChef = (id: string | number | Array<string | number>) => {
  return request({
    url: '/kitchen/chef/' + id,
    method: 'delete'
  });
};
